package com.sixteen.theGreat.workbench.service.impl;

import com.sixteen.theGreat.commons.entity.ReturnObject;
import com.sixteen.theGreat.workbench.entity.TalkRemark;
import com.sixteen.theGreat.workbench.mapper.TalkRemarkMapper;
import com.sixteen.theGreat.workbench.service.TalkRemarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("talkRemarkService")
public class TalkRemarkServiceImpl implements TalkRemarkService {
    @Autowired
    private TalkRemarkMapper talkRemarkMapper;

    /**
     * 添加评论
     * @param talkRemark 要添加的评论所封装到的实体类
     */
    @Override
    public Object addTalkRemark(TalkRemark talkRemark) {
        int reg= talkRemarkMapper.insertTalkRemark(talkRemark);
        ReturnObject returnObject=new ReturnObject();
        try {
            if (reg > 0){
                returnObject.setCode(1);
            }else {
                returnObject.setCode(0);
                returnObject.setMessage("系统繁忙,请稍候...");
            }
        }catch (Exception e){
            returnObject.setCode(0);
            returnObject.setMessage("系统繁忙,请稍候...");
            e.printStackTrace();
        }finally {
            return returnObject;
        }
    }
}
